/////////////////////////////////////////////////////////////////////////////
// Copyright(c) 2012-2015 purang All Rights Reserved
// Name:        rw_lock.cc
// Purpose:
// Author:      syy
// Modified by:
// Created:     2014/1/3 15:39
// RCS-ID:
// Licence:
/////////////////////////////////////////////////////////////////////////////

#include <assert.h>

#include "rw_lock_wrapper.h"

#if defined(_WIN32)
#include "rw_lock_generic.h"
#include "rw_lock_win.h"
#else
#include "rw_lock_posix.h"
#endif

namespace qb {

RWLockWrapper* RWLockWrapper::CreateRWLock() {
#ifdef _WIN32
  // Native implementation is faster, so use that if available.
  RWLockWrapper* lock = RWLockWin::Create();
  if (lock) {
    return lock;
  }
  return new RWLockGeneric();
#else
  return RWLockPosix::Create();
#endif
}

}  // namespace qb
